var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("StarNode"),
    s = cc._decorator,
    c = s.ccclass,
    p = s.property,
    l =
        (s.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.sprite = null;
                e.maxNode = null;
                e.starNode = null;
                e.levelCount = null;
                e.levelIndex = 0;
                e.touchTime = 0;
                return e;
            }
            e.prototype.onLoad = function () {
                this.node.on(cc.Node.EventType.TOUCH_START, this._touchStart.bind(this), this);
                this.node.on(cc.Node.EventType.TOUCH_END, this._touchEnd.bind(this), this);
            };
            e.prototype._touchStart = function () {
                this.touchTime = Date.now();
            };
            e.prototype._touchEnd = function (t) {
                Date.now() - this.touchTime < 300 &&
                    t.getStartLocation().sub(t.getLocation()).mag() < 20 &&
                    this.clickLevelIndex();
            };
            e.prototype.getLevelIndex = function () {
                return this.levelIndex;
            };
            e.prototype.onDestroy = function () {
                EVUIEffView.offTarget(this);
                this.node.off(cc.Node.EventType.TOUCH_START);
                this.node.off(cc.Node.EventType.TOUCH_END);
            };
            e.prototype.setLevelItem = function (t, e, o, a) {
                this.setSpriteData(t, e, a);
                this.levelCount.string = "" + (o + 1);
                this.levelIndex = o;
            };
            e.prototype.closeRec = function () {};
            e.prototype.setSpriteData = function (t, e, o) {
                var a = this;
                this.node.setPosition(t.x, t.y);
                this.node.scaleX = t.sx;
                this.node.scaleY = t.sy;
                this.node.angle = t.r;
                this.maxNode.active = o;
                BundleManager.setSprite(BundleManager.bn.Res, "/UI/mapItem/" + e[t.spf], this.sprite, !0, function () {
                    a.node.width = a.sprite.node.width * Math.abs(t.sx);
                    a.node.height = a.sprite.node.height * Math.abs(t.sy);
                });
            };
            e.prototype.clickLevelIndex = function () {
                EVUIEffView.emit(EVUIEffView.tag_enterLevelItem, this.levelIndex);
            };
            n([p(cc.Sprite)], e.prototype, "sprite", void 0);
            n([p(cc.Node)], e.prototype, "maxNode", void 0);
            n([p(r.default)], e.prototype, "starNode", void 0);
            n([p(cc.Label)], e.prototype, "levelCount", void 0);
            return n([c], e);
        })(cc.Component));
o.default = l;
